/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: MaxLocationInfo
 * @Package com.rx.stock.vo
 * @Description: 最值位置
 * @author: 陈锦韬
 * @date: 2021/9/13
 * @version V1.0
 * @Copyright: 2021 陈锦韬  All rights reserved.
 */
package com.rx.stock.vo;

import cn.hutool.core.bean.BeanUtil;
import com.rx.core.util.RxUtil;
import com.rx.stock.eum.MAX_FLG;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * @author: CHENJINTAO170
 * @Description: 最值位置
 * @date: 2021/9/13
 */
@Data
public class MaxLocationInfo {
    int index;
    BigDecimal amount;
    String maxFlg;
    Date tradeTime;

    @Override
    public MaxLocationInfo clone(){
        MaxLocationInfo clone = new MaxLocationInfo();
        RxUtil.copyProperties(this,clone);
        return clone;
    }

    public void assign(MaxLocationInfo other){
        RxUtil.copyProperties(other,this);
    }

    public static MaxLocationInfo create(StockHistoryInfo other,int idx){
        MaxLocationInfo clone = new MaxLocationInfo();
        clone.setIndex(idx);
        clone.setTradeTime(other.getTradeTime());
        clone.setAmount(other.getClosePrice());
        clone.setMaxFlg(MAX_FLG.MAX.getCode());
        return clone;
    }
    public static MaxLocationInfo create(StockMaxInfo other,int idx){
        MaxLocationInfo clone = new MaxLocationInfo();
        clone.setIndex(idx);
        clone.setTradeTime(other.getTradeTime());
        clone.setAmount(other.getAmount());
        clone.setMaxFlg(other.getMaxFlg());
        return clone;
    }
}
